import * as THREE from "three"

var CONFIG = {
  path: {
    base: (() => {
      var pathname = window.location.pathname
      var regex = /([\/[a-z-_0-9]*\/]*)/g
      pathname = pathname.match(regex)
      return (
        window.location.protocol + "//" + window.location.hostname + pathname
      )
    })(),
    texture: "./assets/texture/",
    sprite: "./assets/sprite/",
    mesh: "./assets/3d/",
    font: "./assets/font/",
    audio: "./assets/audio/",
    video: "./assets/video/",
    model: "./assets/model/"
  },
  device:'pc',
  level: "main_room",
  game: {
    speed: 1,
    difficulty: 1,
  },
  postprocessing: {
    effects: ["Bloom"],
    enabled: false,
  },
  release: (() => {
    var h = window.location.hostname
    var r
    switch (h) {
      case "127.0.0.1":
      case "localhost":
      case "192.168.31.227":
        r = "dev"
        break
      default:
        r = "prod"
        break
    }
    //return "dev"
    return r
  })(),
  touch: {
    show: false,
    input: 2,
    maxInput: 2,
  },
  game: {
    player:{
      walkSpeed : 1,
      runSpeed : 1
    },
    multiplier: {
      scale: 1,
      rotate: 1,
    },
  },
  input: {
    shake: {
      sensitivity: 8, // threshold for acceleration
      timeout: 0.5, // timeout to detect in between shakes
    },
    accelerometerSpeed : 0.2,
  },
  raycaster: {
    near: 0,
    far: 10000,
  },
  camera: {
    world: {
      viewAngle: 90,
      fov: 50,
      near: 0.01,
      far: 10000,
      frustumSize: 600,
      type: "Perspective",
      // position: new THREE.Vector3(1, 1, 1),
      position: new THREE.Vector3(0, 15, 15),
      target: new THREE.Vector3(0, 0, -5),
      zoom: 1,
    },
    ui: {
      viewAngle: 30,
      fov: 30,
      near: 1,
      far: 10000,
      position: new THREE.Vector3(0, 0, 1),
      target: new THREE.Vector3(0, 0, 1),
    },
    controls: {
      enabled: false,
      enableZoom: true,
      enablePan: true,
      enableRotate: true,
      enableKeys: false,
      type: "orbitControls",
      minDistance: 15,
      maxDistance: 2000,
      alphaOffset: 0,
      rotateSpeed: 0.5,
    },
  },

  renderer: {
    clearColor: 0xffffff,
    alpha: true,
    pixelRatio: 2,
    preserveDrawingBuffer:true,
    // toneMapping: THREE.ACESFilmicToneMapping,
    shadowMap: {
      enabled: true,
      renderReverseSided: true,
      antialias: false,
      gammaInput: true,
      gammaOutput: true,
      gammaFactor: 2.2,
    },
  },
  physics: {
    enabled: false,
    gravity: 1,
  },
  debug: true,
  skipintro: false,
  forceOrbitControls: false,
  forceOrientationRules: false,

  menu: {
    enabled: true,
  },
  fog: {
    enabled: false,
    color: 0xffffff,
    distance: 0.004,
    near: 500,
    far: 950,
  },
  hemisphereLight: {
    color: [0.5, 0, 1],
    ground: [0.2, 1, 1],
    position: [0, 0, 0.1],
  },
  scenes: {
    mainScene: {
      name: "main scene",
      render: true,
    },
    uiScene: {
      name: "ui scene",
      render: false,
    },
  },
}

export { CONFIG }
